//
//  ButtonProtectScene.m
//  WidgetTest
//
//  Created by 李明明 on 15/10/10.
//  Copyright © 2015年 李明明. All rights reserved.
//

#import "ButtonProtectScene.h"

@interface ButtonProtectScene ()
@property (nonatomic, weak) IBOutlet UIView *testView;
@end

@implementation ButtonProtectScene

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
- (IBAction)clicksAction:(id)sender
{
    UIButton *button = (UIButton *)sender;
    [button removeTarget:self action:NULL forControlEvents:UIControlEventTouchUpInside];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [button addTarget:self action:@selector(clicksAction:) forControlEvents:UIControlEventTouchUpInside];
    });
    self.testView.backgroundColor = [UIColor colorWithRed:arc4random() % 255 / 255.0 green:arc4random() % 255 / 255.0 blue:arc4random() % 255 / 255.0 alpha:1];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
